package com.fjwt.gz.mgr.ctrl.score.stat.export;

import com.fjwt.gz.db.dto.StatScoreNumMonthDTO;
import com.fjwt.gz.db.entity.SysExportTaskEntity;
import com.fjwt.gz.db.vo.StatScoreNumMonthVO;
import com.fjwt.gz.service.activity.AbstractExportReport;
import com.fjwt.gz.service.impl.StatScoreNumMonthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ------ 福分明细记录报表导出
 * @author myf
 */
@Slf4j
@Service
public class ScoreNumMonthExportReport extends AbstractExportReport<StatScoreNumMonthVO> {

    @Autowired
    private StatScoreNumMonthService statScoreNumMonthService;



    private static final Map<String, String> HEADER_ALIAS_MAP = new HashMap<>();
    static {
        HEADER_ALIAS_MAP.put("agentName", "单位");
        HEADER_ALIAS_MAP.put("totalSyncScoreNum", "旧平台迁移过来福分");
        HEADER_ALIAS_MAP.put("monthAddScoreNum", "月新平台生成福分");
        HEADER_ALIAS_MAP.put("monthAddBaifuScoreNum", "月百福进门生成福分");
        HEADER_ALIAS_MAP.put("monthExchangeCouponScoreNum", "月福分兑换福券消耗积分情况");
        HEADER_ALIAS_MAP.put("monthConsumeCouponYuan", "月福券核销情况（元）");
    }


    @Override
    public String exportActivityExcel(SysExportTaskEntity sysExportTaskEntity) {
        StatScoreNumMonthDTO scoreNumMonthDTO = getRequestParam(sysExportTaskEntity.getRequestParam(), StatScoreNumMonthDTO.class);
        List<StatScoreNumMonthVO> list = statScoreNumMonthService.selectExportScoreNumMonth(scoreNumMonthDTO);

        return createExcelAndUploadOssUrl(list, HEADER_ALIAS_MAP, sysExportTaskEntity);
    }
}
